package se19team1e.dao.abstrakt.jaas;

import java.util.List;

import se19team1e.dao.abstrakt.generics.DataAccessObject;
import se19team1e.entity.AccountDTO;
import se19team1e.exception.DataAccessException;

/**
 * An abstract DAO interface to manipulate the account objects in the
 * persistence storage.
 * 
 * <p>
 * This interface is referenced by controllers, such that the underlying
 * persistence mechanism can be swapped out easily in the future. It does it by
 * extending the DataAccessObject with generic and passing the parameter
 * AccountDTO to identify that this handles Account
 * </p>
 * 
 * @author Palaniappan Vairavan
 * 
 */
public interface AccountDAO extends DataAccessObject<AccountDTO> {

	/**
	 * Look up the account by the username.
	 * 
	 * @param username
	 *            User name to look up.
	 * @return Account, if any. Otherwise null.
	 * @throws DataAccessException
	 *             Data access problems
	 */
	public AccountDTO retrieveByUsername(String username)
			throws DataAccessException;

	/**
	 * Create the Account DAO using interface DataAccessObject
	 * 
	 * @param AccountDTO
	 *            The Account DTO
	 * @throws DataAccessException
	 */
	@Override
	public boolean create(AccountDTO dtoType) throws DataAccessException;

	/**
	 * Deletes an existing Account object from the persistence storage by the
	 * given id.
	 * 
	 * @param idType
	 *            ID of the account object to be deleted
	 * @return success state
	 * @throws DataAccessException
	 */
	@Override
	public boolean delete(Object idType) throws DataAccessException;

	/**
	 * Retrieve all account objects in the persistence storage.
	 * 
	 * @return list of account DataTransfer objects
	 * @throws DataAccessException
	 */
	@Override
	public List<AccountDTO> retrieveAll() throws DataAccessException;

	/**
	 * Gets an existing account object from the persistence storage by the given
	 * id.
	 * 
	 * @param idType
	 *            ID of the account object
	 * @return Object account object specified by the ID
	 * @throws DataAccessException
	 */
	@Override
	public AccountDTO retrieveById(Object idType) throws DataAccessException;

	/**
	 * Updates the delta of an existing object to the persistence storage.
	 * 
	 * @param AccountDTO
	 *            dto type is Account
	 * @return Object updated account DTO
	 * @throws DataAccessException
	 */
	@Override
	public AccountDTO update(AccountDTO dtoType) throws DataAccessException;

}
